package com.hfi.ood.litejunit.v2.framework.decorator;

import com.hfi.ood.litejunit.v2.framework.Test;
import com.hfi.ood.litejunit.v2.framework.TestResult;

/**
 * @author ChangLiang
 * @date 2020/5/27
 */
public class TestSetup extends TestDecorator {

    public TestSetup(Test test) {
        super(test);
    }

    @Override
    public void run(TestResult testResult) {

        testResult.runProtected(this.getTestDecorator(),()->{
            setUp();
            // 这里使用TestDecorator的basicRun方法
            basicRun(testResult);
            tearDown();
        });
    }

    /**
     * Sets up the fixture. Override to set up additional fixture
     * state.
     */
    protected void setUp() throws Exception {
    }
    /**
     * Tears down the fixture. Override to tear down the additional
     * fixture state.
     */
    protected void tearDown() throws Exception {
    }
}
